/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package backbean;

import bit.service.MaquinaService;
import javax.faces.model.ListDataModel;


/**
 *
 * @author marcelo
 */
public class ListarTodasAsMaquinasBB {
    private ListDataModel maquinas;
    private MaquinaService maquinaService;
    private String filtro;


    /** Creates a new instance of ListarTodasAsMaquinasBB */
    public ListarTodasAsMaquinasBB() {
        //ApplicationContext context = new ClassPathXmlApplicationContext("./applicationContext.xml");
        //this.maquinaService = (MaquinaService) context.getBean("maquinaService");

    }

    public MaquinaService getMaquinaService() {
        return maquinaService;
    }

    public void setMaquinaService(MaquinaService maquinaService) {
        this.maquinaService = maquinaService;
    }

    public ListDataModel getMaquinas() {
        this.AtualizaListaDeMaquina();
        return maquinas;
    }

    public void setMaquinas(ListDataModel maquinas) {
        this.maquinas = maquinas;
    }

    private void AtualizaListaDeMaquina(){
        this.maquinas = new ListDataModel(maquinaService.getTodasAsMaquinas());
    }

    public String getFiltro() {
        return filtro;
    }

    public void setFiltro(String filtro) {
        this.filtro = filtro;
    }


}
